Why did the confederates lost